package com.changgou.controller;

import com.changgou.bean.User;
import com.changgou.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Controller
@RequestMapping("/us")
public class UserController {


    @Autowired
    RedisTemplate redisTemplate;

    @Autowired
    private UserService userService;

    @RequestMapping("/loginbg")
    public String loginbg(@RequestParam("iponenum") String iponenum,@RequestParam("pwd")String pwd){
        User user =   userService.getUserDetil(iponenum,pwd);
        if (null == user) {
            return null;
        }
        redisTemplate.opsForValue().set("iponenum",iponenum,60*60*24);
        redisTemplate.opsForValue().set("loginStatus","true");

        user.getUSER_PWD();
        return null;
    }
}
